package chan.project.aimodule.Service;// MessageProducer.java
import chan.project.smartlawcommon.config.RabbitMQConfig;
import jakarta.annotation.Resource;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.stereotype.Service;

@Service
public class MessageProducer {

    @Resource
    private RabbitTemplate rabbitTemplate;

    /**
     * 传递法律法规
     * @param message
     */
    public void sendLegalMessage(String message) {
        rabbitTemplate.convertAndSend(
            RabbitMQConfig.LEGAL_EXCHANGE,
            RabbitMQConfig.ROUTING_KEY_LEGAL,
            message
        );
        System.out.println("Sent to legal queue: " + message);
    }

    /**
     * 传递法律文书
     * @param message
     */
    public void sendInstrumentMessage(String message) {
        rabbitTemplate.convertAndSend(
            RabbitMQConfig.LEGAL_EXCHANGE,
            RabbitMQConfig.ROUTING_KEY_INSTRUMENT,
            message
        );
        System.out.println("Sent to legal document queue: " + message);
    }
}